#delimit;
set more off;

set logtype text;
log using /home/dnc2101/Accidental_Deaths/Vital_Stats/Data_For_Appending/append_ICD_10_years.txt, replace;

set mem 500m;





/********************************************************************************************************************/
*
* This do file takes the Vital Statistics datasets on the injury-related deaths that occur in each year between
* 1999 through 2004 - injuries being accidents, murders, suicides, and injuries of unknown intent - and appends it 
* together into one dataset.  The years between 1999 and 2004 are all years in which ICD-10 - International 
* Classification of Disease version 10 - coding is used to describe the cause of death.  The Vital Stats Mortality
* Files switched to using ICD-10 codes rather than ICD-9 codes in 1999, which is why data from the years 1999-2004 
* are appended together into a dataset that's seperate than the Vital Stats data from 1981 through 1998
* 
* Program by Dan Carvell, written between Summer 2007 and Spring 2010.  
*
*********************************************************************************************************************/










use "/home/dnc2101/Accidental_Deaths/Vital_Stats/dta_files_other_years/mort1999.dta", clear;

append using "/home/dnc2101/Accidental_Deaths/Vital_Stats/dta_files_other_years/mort2000.dta";
append using "/home/dnc2101/Accidental_Deaths/Vital_Stats/dta_files_other_years/mort2001.dta";
append using "/home/dnc2101/Accidental_Deaths/Vital_Stats/dta_files_other_years/mort2002.dta";
append using "/home/dnc2101/Accidental_Deaths/Vital_Stats/dta_files_other_years/mort2003.dta";
append using "/home/dnc2101/Accidental_Deaths/Vital_Stats/dta_files_other_years/mort2004.dta";





** note - in the data for the ICD-9 years, 1981-1998, the year is given by the variable "datayear", which takes the values 81 to 98;
** the variable "year" is in that data only for the years 1997 and 1998, and equals 1997 or 1998 when it is in the data;


sort fipsstr year;
order fipsstr year;

compress;

save "/home/dnc2101/Accidental_Deaths/Vital_Stats/Data_For_Appending/Injury_Deaths_99_04.dta", replace;


summarize;


log close;











